Characters foil each other by highlighting similarities and differences. On the simplest level, Robert and the narrator are foils because they are the two men in the woman's life. One man is blind, and one is sighted; one seems wise, one ignorant; one communicates well with the narrator's wife, and one does not.
Similarly, the narrator and his wife are foils for each other. She's the sensitive, artistic type, and, at least at first, he seems like a callous, insensitive person, who doesn't care much about art.
The narrator and the officer are also foils because they are/were part of the woman's romantic life. Beulah, the officer and the narrator are foils because they both had to deal with the woman and Robert's long-distance relationship. As we discuss above, the main characters in particular all play similar, almost interchangeable roles in the story. Yet, they remain distinct characters, each bringing something special to the table.