definition 1: to note the likenesses and differences of.
example: The professor compared the economic system in the U.S. with the economic system in China.
example: She’s always comparing him with his brother and making him feel like he doesn’t measure up.
definition 2: to liken (one thing) to another.
example: He compared her eyes to two shimmering pools.
example: She compared her daughter’s room to a pigsty.
See full entry
According to strict grammarians, the word “compare” should be followed by “with” when it is used in the first meaning above (e.g., “She’s always comparing him with his brother”). Only in its second meaning–to liken one thing to another– should “compare” be followed by “to” (e.g., “She compared her daughter’s room to a pigsty”). In ordinary speech, however, people commonly use “compare to” with the first sense of the word as well as with the second (e.g., “Compared to last year, we’ve had very little rain”; “If we compare the newer product to the older, we can see that the older is superior”). However, if you want your own speech and writing to be technically “correct,” it is advisable to distinguish “with” and “to,” and to use “with” for the first sense of “compare” and reserve “to” for the second sense.