It would have been helpful to know the specific portion of the play to which you're referring; however, I think you must mean Mercutio's Queen Mab speech.
When we meet him, Romeo is pining and moping and depressed over his unrequited love for Rosaline. It's bad. His friend Benvolio has convinced Romeo to put on a mask (literally and figuratively) and come crash the Capulet party to meet some new girl to take his mind off his woes. Romeo agreed, but only because he hoped to catch a glimpse of his beloved Rosaline.
Before they get there, the group of boys are joking and teasing one another--and no one is more prolific at it than Mercutio. He says, "I see Queen Mab hath been with you." He follows with a lengthy description of this dream fairy who rides in an empty hazelnut carriage, drawn by "her wagoner, a small gray-coated gnat." She "gallops by night through lovers' brains, and then they dream of love."
This fantastical speech, lighthearted and rather whimsical, turns dark and even frightening for Mercutio by the end; but he uses humor and the mythical Queen Mab in an attempt to lure his friend out of the doldrums of lovesickness.
Mercutio gives his famous "Queen Mab" speech to distract the gloomy Romeo from romantic problems. Romeo is sad because Rosaline doesn't return his love.
Queen Mab is the fairy queen, and Mercutio's description of the dreams that come from fairies is a clever, powerful speech. In fact, he gets so excited that Romeo eventually tells him to stop talking.