Great question. It seems like no matter the current form of a Terapagos in the back of the party,
Beat Up is using the Baby's base Attack.
You can see the testing in this footage. I chose Ambipom with Pick Up because of its lack of any STAB or other modifiers. Terapagos-Terastal and Terapagos-Stellar appeared to be giving damage rolls low enough that they could only be possible if the Baby form's base Attack stat was being used in Ambipom's Beat Up calculation.
Of course, it's very easy for human error to slip into tests like these with so many variables especially, and so I've included stats in the footage and always appreciate more eyes to double-check these things. I will update this post as soon as I can if I'm corrected.
No idea as of yet if this would differ for Doubles environments where both Terapagos and the Beat Up user are active, or maybe if it would differ if Terapagos itself was the one using Beat Up. I may check these alternative scenarios out late this month or early next month if nobody else feels like doing them first, but I'll be taking a short break for winter festivities.
Hope this helps.