"Compare A with B" 的意思是「把Ａ和Ｂ作出比較」：
Let's compare CY Leung with Henry Tang to see which person is more suitable to become the next Chief Executive of Hong Kong.
It's no use comparing apples with oranges as they are completely different.
"Compare A to B" 的意思則是「把Ａ比作Ｂ」：
Jeff compares Chen to an angel.
(Jeff 把 Chen 比擬為天使。)
A lot of people compared Mr Tang to a pig.
The coach compared his strength to that of an ox.