The two expressions are interchangeable for the most part, although there are a few situations where one might sound better than the other...

He compares himself to other people too often ("compares to" seems to infer a greater contrast between the things being compared)
He compared dry cereal with hot cereal and decided he liked dry cereal better ("compare with" seems to infer less contrast)