An unscrupulous spy (John Barsad) falsely testifies that he observed Darnay sailing on a ship from France to England, and passing a mysterious-looking envelope to a mysterious-looking person. This is damning testimony, as it seems to prove - in the eyes of the court at least - that Darnay is a spy trading in state secrets.
Stryver, Darnay's attorney, asks the witness if he can be absolutely sure that the man in the courtroom is the man that he saw on the ship. The witness replies that he is. Stryver the asks his associate, Sydney Carton, to stand up. Everyone in the court expresses shock and disbelief when they see that Carton and Darnay look almost exactly alike. The witness's testimony is fully discredited, as it is revealed that he easily could have mistaken Darnay for someone else. It was Sydney Carton's idea to have Stryver compare the appearance of the two men. Thus, this scene becomes the first of two times in the novel (the other occurs at the very end) when Carton saves Darnay's life.
This question has already been asked and answered here on eNotes. Here is a link for you: http://www.enotes.com/tale-of-two-cities/q-and-a/what-fact-clinches-darnays-acquittal-book-second-266975