That's as simple as Devers and his .409 On Base % in front of Bregman. Meanwhile, Raffy bats right after Duran and his .313 On Base %.
Nowadays, in the age of Everybody Ks, the order doesn't make much difference (at least in Boston).
Back when pitchers dominated last century, the tradition was to bat you best hitter 3rd, after a fast leadoff and a #2 guy who could hit a grounder to the right side.
Now we have Schwarber leading off, for a quick lead with his HRs, and also because he wears down the pitcher for subsequent batters. Ideally, that's another good reason to bat a guy like Soto 2nd (at least last year it was).
But one tradition remains: if the first three hitters all reach base, it sure helps to have a big bopper at clean-up who could potentially clear the sacks. That's why I'd bat Anthony 2, Bregman 3, Raffy 4.
Clean-up just hasn't worked out much lately for guys the Sox were hoping on, like Dalbec and Casas. Maybe Justin Gonzales can someday be that guy. He's only 18, so if he arrives by, say 2027, the Sox might even promote Anthony and Mayer by then...