Highly gifted children are always thinking. It’s a fascinating activity, more interesting than what the teacher is saying, so why should they listen?
Then, what the teacher taught is on the test and these students get bad grades. Not because they lack ability but because the material never compelled their attention.
The only real solution is to ask these children what they like to think about, and then just keep asking questions. You can gain a surprising amount of information this way, and by inviting yourself into their inner worlds, can begin to make sense of the compelling pull their thoughts exert on them.
After that, it might be possible to open a conversation about how they can pursue what’s most interesting to them, and this in turn could lead to success in that area.