Explanation
The claim cannot be confirmed as an unqualified fact. Interpreted as stars in the universe versus all grains of sand on Earth, it depends on uncertain estimates and on which sand deposits are included.
The European Space Agency gives a rough stellar estimate of 10^22 to 10^24, explicitly warning that galaxies differ. In Astronomy, Bob Berman describes his own approximate calculation and reaches a different conclusion from the familiar saying, particularly when deserts and underwater sand are included.
These sources do not establish a precise global comparison. Beach sand is only one subset of Earth's sand, and estimates of the observable universe cannot establish the total for the entire universe. The evidence supports caution rather than a definitive numerical ranking.
Key takeaway
More stars than sand is a memorable comparison, not a securely established count of all stars versus all terrestrial sand.