The Bruins trailed by two goals entering the third period before McAvoy scored to make it 4-3 at 10:22, and Grzelcyk tied the game 4-4 at 16:00.
"Those are the guys we rely on for offense," Boston coach Bruce Cassidy said of the defensemen. "They came through for us, but you know it was a real struggle at the other end. Our first touch tonight was probably as poor as it's been all year, and it led to some goals-against.
"So it's nice when you can learn lessons when you get two points. We were able to outscore our mistakes tonight. And good for [Grzelcyk] and Charlie, they're the leaders of the back end right now. … Happy for them."
Jaroslav Halak made 31 saves, and David Krejci and Craig Smith each had three assists for the Bruins (18-9-5), who split the two-game set after a 1-0 loss here Sunday.
Mackenzie Blackwood made 44 saves, and Travis Zajac became the fourth player to score 200 goals for the Devils (13-16-5), who have lost three of four.
"I thought our puck play, which was pretty good through two periods, in the third period kind of let us down," New Jersey coach Lindy Ruff said. "We didn't execute sometimes leaving the zone. Spent extra time with some plays late in the zone that if we make better plays, I think we're going up ice, creating opportunities."
Miles Wood gave the Devils a 1-0 lead when he scored at 1:28 of the first period on their first shot on goal.
Nick Ritchie tied it 1-1 at 5:55 on a wrist shot from the top of the right face-off circle off Blackwood's glove.
Michael McLeod scored on a breakaway to put New Jersey ahead 2-1 at 9:34.
Zajac made it 3-1 on a tip-in from the slot at 3:45 of the second period.
"It just means I've played with some good players that made me look good," Zajac said of the milestone. "It was nice to contribute. But other than that, you know it would've been nice to get the two points."