To assess the similarities and differences between two or more things ["to compare X with Y"]. Having made the comparison of X with Y, one might have found it similarto Y or different from Y.
To declare two things to be similar in some respect ["to compare X to Y"].