To compare, you write the similarities between 2 topics. To contrast, you write the differences between the 2. For example, dogs and cats.
They both are able to sense the emotions of their humans(compare), but dogs bark, and cats meow/hiss(contrast).
---
hope it helps