In literature, a foil is a character that serves to contrast with another character. This is to better highlight or differentiate certain qualities of that character (usually the protagonist).