Grandparents rights are very limited. In MA, there is a complaint for grandparent visitation but to meet the burden a grandparent has a high burden. The grandparent must show that they basically cared for the child at some point. It is almost easier to get custody through a guardianship where the grandparent must show that the parent is unfit. In Troxel v Granville, the Supreme court found that a Washington state visitation law was unconstitutional in violating the parents due process rights to raise their children. On a practical level, many probate court Judge's favor the parents and grandparents stipulating to a schedule even if the case might otherwise be dismissed.
In DCF cases, family is supposed to be looked at first and grandparent can get custody or be a foster care provider.