Like Legolas, Gimli doesn't appear much in The Return of the King. He is certainly around, but his main role seems to be to comment on what's going on in the book. The conversations between Legolas and Gimli become almost like a chorus from a classical play.
In Greek tragedies, you would often have a small band of guys standing on the sidelines and commenting on the action onstage. Since Gimli and Legolas are part of the action of The Return of the King, but not as intimately involved as Aragorn (whose kingdom is at stake) or Frodo (whose soul is at stake), their conversations have a similar tone of analysis. Take, for example, this exchange between Legolas and Gimli in Minas Tirith:
"That is a fair lord and a great captain of men," said Legolas. "If Gondor has such men still in these days of fading, great must have been its glory in the days of its rising."
"And doubtless the good stone-work is the older and was wrought in the first building," said Gimli. "It is ever so with the things that Men begin: there is a frost in Spring, or a blight in Summer, and they fail of their promise."
"Yet seldom do they fail of their seed," said Legolas. "And that will lie in the dust and rot to spring up again in times and places unlooked-for. The deeds of men will outlast us, Gimli."
"And yet come to naught in the end but might-have-beens, I guess," said the Dwarf.
"To that the Elves know not the answer," said Legolas. (5.9.12-16)
Since neither Gimli nor Legolas are human, they can speculate about what will happen to Middle-earth when it is left to men entirely to govern. Gimli's point of view is that ancientness is always better. Men were once greater than they are now, and history is a matter of going from good to mediocre to bad. Legolas is a little more optimistic. Yes, men's bloodlines fail and civilizations fall, but they always crop back up again, even in unexpected places.
As a dwarf, Gimli assumes that he'll be A-okay traveling underground through the darkness of the Paths of the Dead along with Aragorn, but his deep terror walking through the territory of the Sleepless Dead underlines that this is no ordinary cave. Gimli's willingness to accompany Aragorn through his complete horror proves that Aragorn is capable of inspiring great love in his followers (check out his "Character Analysis"), but it also shows that Gimli is a loyal friend to begin with.
One last thing about Gimli: he and Legolas do actually keep the promises they made to each other to visit the Glittering Caves of Aglarond and Fangorn (see The Two Towers for details). So Tolkien takes care to tie up even this tiny loose end, while affirming the true friendship of our favorite elf and dwarf.