Yes, both phrases are grammatically correct.
**Meaning:**
- "Cultivate the habit of prayer" suggests developing a routine of engaging in prayer as a practice or activity. It's more focused on the concept of prayer itself.
- "Cultivate the habit of praying" emphasizes the action of praying, focusing on the act of performing the prayer regularly.
**Rephrasing:**
1. "Develop a routine of prayer."
2. "Nurture the practice of praying."
3. "Foster