what is the difference between 'similarity to' and 'similarity with'?

Solution 1:

Both are found, but there is no obvious difference in meaning. Similarity to is the preferred construction in both American and British English. The Corpus of Contemporary American English has 332 records for similarity to and 52 for similarity with. The figures for the British National Corpus show a less pronounced preference, but, with corresponding figures of 105 and 34, it is still significant.

The Oxford English Dictionary supports this finding with 103 citations for similarity to and only 14 for similarity with.

Solution 2:

Similarity to is the more idiomatic in your example, but similarity with would be used if you were referring to shared similarities:

A shares some similarities with B.