What is a Character Foil?

A character foil is a character that contrasts with the main character. A character foil also usually has some characteristics that are similar to the main characters.