It depends on the context, but they are both correct. compare to means "to represent as similar" [ She compared him to a wild stallion. ] compare with means "to examine the ways in which two things are similar" [ The study compared the language ability of apes with that of dolphins.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.