Whether or not you agree with a person's views or not, we live in a country where we're allowed to have different opinions. The grandfather, however, appears to have gone from contempt to vehemently hostile and has spent years trying to separate the man from his own daughter, and appears to have been the part of the main reason the man and the woman broke up in the first place (the direct cause with distance and arguing so often, but it was the attempts to overtake their parenting role and the open hostility from the woman's family that caused the rift in the first place, if the account is true and I'm reading correctly). The grandfather may not have liked him or his views, but that alone is no reason to go as far as he did to remove him from his daughter's life.
Unfortunately, even if they got all the support that they possibly could, it's still no guarantee that the right thing will be done and he'll get any custody. What Dr_Sword's described is more common than the good father getting custody over the lesser qualified mother simply because she is the mother and because the father didn't have enough "redeeming" qualities. In this case, the father has little money, so all the mother/grandfather's lawyer has to do is push on this in a normal court to tilt things dangerously in their favor, and it could get much worse if everything is held in a court that is sympathetic to the grandfather's religious views against atheism.