There are many ways to establish authority and gain custody over a child that is not yours. Two options include "Guardianship" and "Non-Parent Custody" (also known as in loco parentis custody). The differences between the two are great and require a thorough analysis of each person's individual situation.
The State of Arizona has a provision which allows grandparents to have visitation rights over a parent's objection. In order to accomplish this; (1) the grandparent must overcome the presumption that the parent always acts "in the best interest of the child," and (2) access to the grandparents is in the child's best interest. This burden must be overcome by a "preponderance of the evidence" (i.e. the grandparent must show by a 51% probability that visitation is "in the child's best interest").