Oh, what to do when a customer passes you by in the grocery store, drops a pack of Oreos, and your toddler lets out S@?#!. As embarrassing as this is, the experience is really common. Toddlers are sponges at this age—which is how they begin to learn language at such a rapid rate in the first place. And they definitely will mimic the words of the adults around them.
But (cringe!) how to react—without dropping a bomb, yourself?
What They Understand
Around 24 months, toddlers do not understand the meaning of swear words nor do the conventions of polite conversation (ok, or basically any etiquette at all) make sense to them. But kids this age do understand the reactions from the adults around them when they speak. If a word gets a lot of reaction, even if it is a negative reaction, this can reinforce the use of a word. So if your child gets a laugh from an adult when he utters something, he definitely will try it out again.
What to Say
First, hard as it is, give it a shot to not say anything at all. (You can also instruct the other adults in your toddler's life to not react—including snickering or laughing—to curse words, and offer the reason behind it.) Most likely, your child is swearing for a reaction, and for her, the bigger and broader the audience, the better. You may find that without any attention, your toddler's swearing will be short-lived and they will move on to other words.
If you are finding that your toddler is repetitively using a four-letter favorite, do a little research. What's the positive and negative feedback they are getting from other people in their world, who might be reinforcing this pattern? Where else may your toddler be overhearing the language—older siblings, daycare providers, grandparents? Some parents do try the "We don't use that word" approach, but this definitely can backfire, so remember to not give the swearing too much attention.
What to Do
Watch what you say! Toddlers are only introduced to swearing from folks around them—i.e., that call with your sister-in-law, the primetime dramas you're watching. Of course, most parents have the experience of dropping something or getting cut off at an intersection and letting a @#$% fly out their mouth. Don't be too hard on yourself, but know your little mimic is listening and learning!
Don't allow any show-pony routines. Well-meaning relatives who try to encourage your toddler to display her, er, talents are just egging on the bad habit. Make it clear you're not tolerating any verbal performances.