Compare with is used to place two things side by side for the purpose of examining their similarities or differences.
E.g. It is interesting to compare X with Y. Compare to used to assert that two things are alike.
E.g. The economy is compared to a running horse!