Child custody laws for grandparents are an important safety net in today's complex society. It wasn't that long ago, one hundred to two hundred years, over the millions of years of evolution, that families lived and died within a fifty-mile radius of where they were born. The only means of transportation for much of human history was walking.
When humans could only walk there was a much tighter extended family unit. Today, a car or jet can spread a family far and wide in a matter of hours. With physical separation of families comes emotional separation as well. Because of the transient nature of our residence, the extended family unit suffers as a consequence: Divorce is at an all time high.
One of the most important human relationships that are at risk is the grandparent grandchild relationship. Courts have realized that child custody laws for grandparents are an important stabilizing factor for this very reason. When grandkids can have visitation with their loving grandparents they have a better perspective on where they came from and where they are going.
Grandparents usually love their grandkids deeply. It is a different type of love than the love they have for their own children. Since they are usually removed from the task of having to raise the grandchildren they get to have "the most fun" with the grandkids. The term "spoiling them rotten" is used a lot. As grandparents age their grandchildren often become their greatest joys in life. They see the life cycle continue, one which they started.