A foil in literature describes a character who contrasts with another character in order to make comparisons and highlight certain traits between these two persons.
Both Melantho and Eurycleia are servants of Odysseus. While Melantho is unloyal, (sleeping with the suitors while Odysseus is away) and treating him rudely when he returns disguised as a beggar, Eurycleia remains devoted and kind. Melantho is used as a foil for Eurycleia to showcase her good traits.