hey,
From my experience flying into Brasil with a domestic connection at GRU... I had to get my luggage and clear customs then check-in with TAM domestic and re-enter the domestic departure terminal, go through security, etc...
I can't remember how it worked when leaving Brasil, but I'm *quite* sure that once you get to GRU from BSB... you'll need to pick up your luggage and re-enter the international departures terminal (go through security and customs).
How long is your layover in GRU?