My younger son’s math teacher’s recommendation said he had one of the best math minds in the class even though he didn’t have the best grades. My son was always forgetting the easy way to do problems so his tests were full of him figuring theorems out from scratch. The letter apparently was quite specific about how my son had a command of math theory even if he didn’t always master math facts or math shortcuts. I didn’t see the letter though, so I can’t provide it, I just heard about it.
My older son’s best letter was from a professor for whom he wrote a program that sequenced peptides for his medical research. He talked about how none of his own graduate students knew how to do this kind of program, and how surprised at how quickly my son was able to provide him what he needed. But that’s not particularly relevant to what a high school teacher would provide.