As you might expect of Shakespeare, literary devices abound in this play. In Portia's famous speech about mercy, given when she is disguised as a male lawyer, she uses a metaphor, or comparison, likening mercy to a gentle rain that is undeserved but blesses and nurtures what it falls upon. She further uses an aphorism, or short, pithy phrase, to sum up mercy: "It blesseth him who gives and him who takes."
The courtroom scene uses dramatic irony, which is the literary device in which the audience knows something the characters in the play do not. This is a favorite technique of Shakespeare's. Here, the audience knows the lawyer is Portia, but the characters do not.
If we look at one more quote, we can find more literary devices:
All that glisters is not gold, Often have you heard that told; Many a man his life hath sold But my outside to behold: Gilded tombs do worms infold (II, vii)
The opening line uses alliteration, which is to use a consonant repeatedly for emphasis. The "g" in glisters and gold helps us remember the contrast between glisters and gold and thus the contrast between outer show (glister) and real worth (gold). The passage also employs rhyme: told, sold, behold and infold, which helps us to remember the important thematic point that money isn't everything. Shakespeare also uses imagery to paint a vivid contrast between a shining, gilded tomb and the worms within it. This imagery also uses the device of juxtaposition of two sharply contrasting images, in this case gilt and worms.