Compare to / Compare with
To “compare to” is to suggest resemblances between things that have essentially different natures:
In appearance, ripples in ocean water can be compared to frosting spread on a cake.
To “compare with” is to suggest resemblances between things that have essentially similar natures:
Despite their different capacities, RAM can be compared with ROM in that both involve memory storage.
A solid rule that will help you to choose the proper phrase is that “compare with” applies when there are two entities that can be measured by a common standard. For example, it is correct to say that “particles are small compared with the wavelength of the light illuminating them,” because “particles” and “wavelength of the light” are measured by the same standard. When a common standard is not used to compare the entities and they have essentially different natures, use “compare to.”