I’d say “Did you know (that …)” is typically used when you are just about to state the information that is being asked about. I’d say it sounds nicer (and/or less like you think you’re a know-it-all) than the more direct “Do you know (that …)”.
I can imagine using “Do you know (that …)” in a more confrontational situation, for example. So, I wouldn’t use it in a sentence like the one you quoted.
Before pepper is ground, you have peppercorns. Possibly the author was thinking of those first and then switched over to thinking about ground pepper. (Without the end of the sentence it’s a little hard to say if there might have been a good reason for that or not. It does seem a bit unusual, though. ;))
Which at the beginning of the sentence: Did you understand what the author wanted to say? If so, then I think we can forgive him. :lol:
It’s technically not the right way to write a sentence, but it’s not unheard of to find things like this in writing.