They can't tell, that's just it.
The only way it would even be possible would be if the MP3 came coded with something which flagged it as containing strong language.
That's the thing. They would have to have some sort of administrator flag it themselves. So parents could edit songs with parental controls. So nintendo would play the mp3 and have another file being executed at the same time. Like a custom file type which would look something like this(0 for nothing 1 for flag):
name size 0001001000000000000111111111100000001000000000000000000000000000000000000000000000000000000000000000111
and every time there was a 1, the speakers would play a beep.
This would be a time consuming process. An easier feature would just be having the parent rate the song themselves and only allow a certain rating to play. Flaws of this would be renaming the song to bypass. However, Nintendo could make some program that locks songs, and only makes them deletable. It all depends on the environment.