Please check both sentences and let me know, which one is correct and why?
She compares me with her boyfriend.
She compares me to her boyfriend.
Here are relevant quotes from three books, written in different times, from different points of view. (All authors are American. The term SAWE is used in one of the books.) I present them here so that the OP and other readers can hear different opinions and decide for themselves what to believe.
Compare. To compare to is to point out or imply resemblances, between objects regarded as essentially of different order; to compare with is mainly to point out differences, between objects regarded as essentially of the same order. Thus life has been compared to a pilgrimage, to a drama, to a battle; Congress may be compared with the British Parliament. Paris has been compared to ancient Athens; it may be compared with modern London.
– The Elements of Style
compare with; compare to.
The usual phrase is compare with, which means “to place side by side, noting differences and similarities between” <let us compare his goals with his actual accomplishments>. Compare to = to observe or point only to likenesses between <the psychologist compared this action to Hinckley's assassination attempt>.
– The Oxford Dictionary of American Usage and Style, Bryan A. Garner
compare to, compare with Use of either is SAWE1 to mean either (a) "liken (something) to (something else)" (You can't compare a Volkswagen to a [or with] Rolls-Royce) or (b) "observe similarities and differences between (something) and (something else)" (Comparing a Volkswagen to [or with] a Rolls-Royce, you notice a big difference in price). Caution: Many readers object to use of compare to to mean (b) and of compare with to mean (a).
– Good Grammar Made Easy, Martin Steinmann and Michael Reller, p.79
1Standard American Written English
Generally, this will go unnoticed by most.
However, if we see this microscopically, we can find the difference.
To compare to is to remark or entail similarity between things/people regarded as different order.
To compare with is generally to remark the differences between things/people regarded as same order.
It's up to her, how she's taking you and her boyfriend!
Imagine a case wherein she's comparing you with her boyfriend that you equally run fast as him; but if she's comparing to her boyfriend, you probably ran faster (positively comparing) or slower (negatively compared)!
I've upvoted @MaulikV's answer here, because although it's quite true that most people in most contexts wouldn't distinguish between compared to and compared with, I think these charts strongly suggest that historically there was indeed a tendency to use to in contexts emphasizing similarity, and with in contexts emphasizing difference.
I think we can be pretty sure most contexts involving has been compared to/with will be calling attention to similarities, whereas contexts involving but compared to/with are almost certainly calling attention to differences.
But that's obviously a historical difference. Clearly the modern trend is to use compare to in all contexts.
It may also be relevant that similarities to is more common than similarities with, but differences with beats out differences to.