Both are grammatical AFAIK. But using while/and in the construction you are using is strange. Also "almost similarly" is a bit strange on it's own.
First to the "while/and" situation.
A,B and C perform similarly while/and C performs slightly better.
Doesn't sound right. In this construction whatever is after the while/and should be new. As an example
A and B perform similarly while/and C performs slightly better.
Sounds perfectly fine to me. It conveys the information you wanted: they are all close in performance but C is a little better. If you list C in the first sentence you're contradicting yourself and the sentence structure doesn't acknowledge it. A though would work instead of the while/and in that case.
A,B and C perform similarly though C performs slightly better.
That is ok. "With" works just fine too. You are using similarly so the sentence starting with "with" just qualifies it further.
To the second part "almost similarly" is strange because "similarly" already contains the information that the performance wasn't the same so the almost doesn't really add any new information. Saying "almost the same" would be fine but that's really just a different way to say "similarly"