I talked with a friend about this question during this weekend, and he pointed out the novel A New Hope: The Life of Luke Skywalker (published in 2009). The story is in line with Pablo Hidalgo's comments and gives us also the in-universe view on the events. Even though his uncle Owen removed the headstones, Luke still got some hint about his grandmother's fate. According to the novel, it was aunt Beru who revealed the identity of Shmi to Luke.
The first chapter takes place when Luke is only four years old:
Sam's gaze had drifted to an area beyond the homestead's open pit.
"Say, something's different over there."
Beru said, "Where?"
"There," Sam said, pointing. "Didn't you have some supply tanks, or
some kind of...?" Sam stopped talking, and then everyone was silent.
Luke noticed the sudden quiet and turned his head to follow the
adults' gaze to the southwest. Except for some moisture vaporators in
the distance, there was nothing to see but scorched ground.
"Sorry, Owen," Sam said, finally breaking the awkward silence. "I just
realized what was, uh, missing. It's the headstones."
Owen said nothing, but just kept his eyes to the southwest.
Sam said, "I, uh, hope it wasn't vandals..."
"No," Owen said. "I removed the headstones."
"Oh," Sam said.
Without any further explanation, Owen turned and headed for the entry
dome. After he was gone, Beru said, "Please forgive Owen. He... he
just didn't see a need for anyone to know where Shmi was buried."
"But he removed all the headstones," Sam said. "His parents and uncle
were buried there too, yes?"
Beru nodded.
Luke said, "Who's Shmi?"
Beru jumped. She hadn't seen Luke in front of the parked speeder and
didn't know that he'd been listening. She glanced at Dama, then back
at Luke and said, "Shmi was your grandmother, Luke."
"Oh," he said. "Is my father buried there too?"
"No," Beru said. "Your father didn't die on Tatooine."
"Oh," he said again. Then he looked at Dama and Sam and said, "My
father was a navigator on a spice freighter. Uncle Owen told me so."
The event remained memorable to Luke, as when he was seven:
He dipped his hand into a pocket and withdrew a droid caller he'd
rigged to allow him to sneak past the small, roving guard droids that
patrolled the homestead's perimeter. Out of habit, he walked carefully
around the area where he knew the bodies of his grandmother and Owen's
parents and uncle were buried.
And while he was fifteen:
The suns were close to the horizon. Looking beyond the homestead's
courtyard, Luke saw long shadows crawling across the desert. And then
his gaze landed on the area of the unmarked graves that included his
grandmother's final resting place.
So, at least in Legends, Luke did learn about his grandmother's fate at young age, despite of his uncle's efforts.
EDIT: It is now canon that the headstones were hidden (not removed) by Owen and Beru. The following images are taken from the comic book Darth Vader 1 published in February 2020.
