A court has authority to grant "reasonable visitation" to grandparents if the natural parents have separated. A grandparent must show there is a preexisting relationship between the grandparent & grandchild that has created such a bond that visitation is in the best interest of the child.
There is also a presumption that no contact is in the child's best interest if both legal parents agree that the grandparent should not be granted visitation rights.
Additionally, if a natural parent is deceased, reasonable visitation my be given to the grandparents and siblings of the deceased parent.
Typically, a child custody judgment rendered between the natural parents will control grandparent contact.