The stones are a millennium-long tradition that represent each new chief on Motonui, an island they were forced to settle on ever since Maui stole Te Fiti's heart
The man singing in the flashback is not her grandfather (that would make him Tala's husband), but her ancestor, Matai Vasa, from a thousand years ago.
The whole point of the flashback is to show Moana that her people used to be voyagers, explorers, living on the ocean, but once Maui stole Te Fiti's heart, monsters appeared in the ocean, making it far too dangerous to go beyond the reef, they were forced to settle on Motonui, where each generation, the new chief lays a new stone.
Moana: We were voyagers. We were voyagers! We were voyagers! We were voyagers! We were voyagers! Why'd we stop?
Gramma Tala: Maui. When he stole from the Mother Island, darkness fell. Te Ka awoke. Monsters lurked and boats stopped coming back. To protect our people, the ancient chiefs forbid voyaging. And now we have forgotten who we are. And the darkness has continue to spread, chasing away our fish, draining the life from island after island.
Moana's shell at the end, on top of the stack of stones, marks an ending to this era of isolation from the sea - her people are now explorers again, and may live on the ocean again.
The stones are flat and grey, representing a monotonous, one-note (boring), unadventurous, but safe and sturdy lifestyle that they have as settlers on the island.
The shell represents the ocean, and its bright colour, in contrast with the flat grey stones, represents an exciting, adventurous life. Also, Polynesian culture is often associated with a spiral, which the shell's shape exhibits, because it is considered a symbol with meaning (known as Koru), and it represents 'going back to the beginning', which perfectly reflects the movie's themes about finding your roots and your identity as part of your growth - here it also represents the islanders reconciliation with their original voyager-culture which they had abandoned for a thousand years.
Koru is the Maori word for “bight” or “loop” and refers to new shoots of the silver fern. The spiral shaped koru design is derived from this unfolding silver fern frond. The circular movement towards an inner coil refers to ‘going back to the beginning’. The unfurling frond itself is symbolic for new life, new beginnings, hope, perfection, rebirth, a new start, awakening, personal growth, purity, nurturing, a new phase (in life), the spirit of rejuvenation, and peace.
—Meaning of Maori Symbols and Designs, Tuarangi
This symbology appears throughout the movie Moana, as this meaning of koru reflects the movie's main themes of finding your identity and growing, rejuvenated. In this case it applies to the people of Motonui, hence the shell/spiral connection, but we also see that the heart of Te Fiti is a spiral, too.
The symbolism and themes become clear in the final scene:
Source, official synopsis:
Three thousand years ago, the greatest sailors in the world voyaged across the vast Pacific, discovering the many islands of Oceania. But then, for a millennium, their voyages stopped – and no one knows why. From Walt Disney Animation Studios comes “Moana,” a sweeping, CG-animated feature film about an adventurous teenager who sails out on a daring mission to save her people. During her journey, Moana (voice of Auli?i Cravalho) meets the mighty demigod Maui (voice of Dwayne Johnson), who guides her in her quest to become a master wayfinder. Together, they sail across the open ocean on an action-packed voyage, encountering enormous monsters and impossible odds, and along the way, Moana fulfills the ancient quest of her ancestors and discovers the one thing she’s always sought: her own identity. Directed by the renowned filmmaking team of Ron Clements and John Musker (“The Little Mermaid,” “Aladdin,” “The Princess & the Frog”) and produced by Osnat Shurer (“Lifted,” “One Man Band”).
Also in the movie itself
Gramma Tala: In the beginning, there was only ocean until the mother island emerged: Te Fiti. Her heart held the greatest power ever known. It could create life itself. And Te Fiti shared it with the world. But in time, some begin to seek Te Fiti's heart. They believed that they could possess it, the great power of creation would be theirs. And one day, the most daring of them all voyaged across the vast ocean to take it. He was a Demigod of the wind and sea. He was a warrior. A trickster. A shapeshifter who could change form with the power of his magical fish hook. And his name was Maui. But without her heart, Te Fiti began to crumble, giving birth to a terrible darkness. Maui tried to escape, but was confronted by another who sought the heart: Te Kā, a demon of earth and fire. Maui was struck from the sky, never to be seen again. And his magical fish hook and the heart of Te Fiti, were lost to the sea. Where even now, 1000 years later, Te Kā and the demons of the deep still hunt for the heart, hiding in the darkness that will continue to spread, chasing away our fish, draining the life from island after island until every one of us is devoured by the bloodthirsty jaws of inescapable death! But one day, the heart will be found by someone who would journey beyond the reef, find Maui, deliver him across the great ocean to restore Te Fiti's heart and save us all.
Maui: Yeah... It almost sounds like you don't like me, which is impossible because I got stuck here for a thousand years, trying to get the heart as a gift for you mortals so you could have the power to create life itself. Yeah. So what I believe you were trying to say is thank you.
Maui: Listen. For a thousand years,I've only been thinking about keeping this hair silky, getting my hook, and being awesome again.