Compare is used to point to likenesses, similarities (used with the preposition to), and to examine two or more objects to find likenesses or differences (used with the preposition with).
Contrast always points out differences.
- The author compared her daughter to a frisky kitten.
- The examiner compared my paper with Asha's and found no signs of copying.)
- In contrast to your presentation, mine is poor.
Also read: Compare to vs. compare with