so if you are the BB, and
all the cards have just been dealt, and you say..."if anyone raises my big blind, im allin"..and someone raises your blind, then you have verbally declared that you are allin??
As JQ identified above, it's the bolded part above that's important - it means you're making the announcement during a hand that's in play.
Effectively, this is the same as the situation in the OP: you're verbally declaring a specific action, just out of turn. You're also making it to the entire table instead of just one player. When the action reaches you, you can be bound by your verbal declaration.
You'd have more latitude if you said
"Don't raise my big blind, I'll defend it" because what specifically does "defend" mean? You haven't said you'll call any raise, you haven't said you'll go all in if you get raised, you've just made a vague empty threat and I don't think you could get held to any action on that basis.
Alternatively, if you say it between
hands I don't believe you'll be held to your word either because there's no specific hand happening at the time to apply the declaration to. I
think - I'm not actually certain on that one. Saying
"I'm the big blind next hand and I'm all in preflop if anyone raises me" before the cards are dealt would likely give a floor manager a massive headache if anyone tried to hold you to it. I don't think you can be, but I'm not certain either, so to be safe just don't do it.
JQ also makes a good point, this will usually only be an issue if the other player(s) in the hand want to hold the person that's made the declaration to their word (in a cash game, at any rate - in a tournament where rules are observed and enforced more strictly, they may be held to their word just on principle).
In a cash game the casino is unlikely to get involved if the players in the hand agree to let the person off and get on with the game, or they make some other kind of deal (like Guy Laliberate letting Benyamine take back a big chunk of his all in bet on HSP when it became apparent he was crushed). They'll only take an interest if someone insists on the verbal declaration being binding and the player refuses to perform the action.
Interestingly, I've read stories where this has happened, the player has refused to hand over the money and the casino hasn't been able to force him to do so. They have, however, given him an alternative: pay your bet, or get thrown out and banned from the casino for life.
The take home lesson from all this really is:
don't make stupid empty threats out of turn. If you don't make the statements to begin with, you'll never have a problem.