I taught kids TMA classes for a little longer than a decade before moving into my own BJJ/MMA school.
There are a number of ways to handle it. Here's my usual M.O. (inherited from my karate instructor of many decades experience):
First time offense (in a single class) - Call them on it, but nicely. Do it in front of the class.
Example: The kids are supposed to be watching, and someone is talking.
Me: "Sir! (Or kid's name) There's no talking right now.
Say it a little gently, but firmly enough that he understands. There is no threat made, no penalty assigned - just a polite request or explanation that the behavior is out of line.
Second offense (in same class) - Stop what you are doing. Look at the student very seriously.
Me: Come here, my friend.
Say it quietly, and motion him over with your hand. Turn yourself and himself away from the group. Come down to one knee so you can look him in the eye. Say this all just above a whisper, so that maybe the nearest kid can hear you a little, but not well.
Me: Ok sir, that's the second time you've talked out while you should be listening. We have five minutes left in the warmup (or whatever) before we move on to the (whatever we do next: rolling, game, end of class...it doesn't matter if it's something fun or not). I'm worried that you aren't going to be able to control yourself until then. I don't want you to have to miss the (whatever we do next). Are you going to be able to control yourself until then?
This is all said very seriously, but plainly. There is no frustration or emotion on the surface. Typically, at this point, the kid will look you in the eye and mumble a response. Get them to repeat themselves clearly. Usually it's a very quiet "yes".
Me: I'm glad to hear that.
Give them a little high five and send them back to line.
Third time - if it happens again, there is no discussion or anger. I'm a big fan of "time out" type situations - the student sits on the side and watches the other kids participate. This drives them crazy.
If a kid continues to be disruptive on the side, I will remove him from the classroom entirely. This also merits a meeting with the parents.
Only once or twice in my entire teaching career have I needed to go to the highest level of punishment: "Go in the dressing room and put on your shoes. You are done for today." The one or two times I had to say it, I thought the kid was going to throw up. It's pretty heavy if you say it correctly.
I've got more, but this is my primary method. It works wonders if you are consistent.
Also, pick up a book called "Back Talk". It's a quick little thing you can read in an hour. It's a great resource for dealing with kids, especially ones that try to slide in little annoying behaviors that don't warrant big punishments. I loved it.