It sounds like customs depend on the field and country, but here's my experience based on mathematics in the U.S. I'll answer based on customs rather than laws, since that's generally more relevant: one can get a bad reputation for doing something perfectly legal, and one can get away with things that aren't legally justified if nobody is willing to enforce their rights in court.
The short version:
Acceptance is understood to be a final decision that commits you to showing up for a year. You can ask to be released from that obligation, but you shouldn't just announce you aren't coming. If you give a good enough reason for your request, they'll grant it. If your reason isn't compelling to them, they won't try to force you to show up but you'll really damage your reputation (not just at that university). Saying you got a better offer afterwards is not considered compelling, and you are expected to withdraw other applications upon accepting an offer.
The long version:
Negotiating does not imply accepting an offer, and in fact you should always try to negotiate over whatever you care about before you accept, since your leverage will never be higher. (Some candidates don't like the idea of having leverage, but you can think of it as a benefit to the department as well: it's much more effective for the department to tell the administration "We need to do X to get our wonderful candidate to accept" than "Our wonderful new hire wishes we would do X".)
Accepting an offer just amounts to saying you accept it. In principle, this could be tricky: people's memories of an oral acceptance could be disputed later, and it's possible to write things that sound like an acceptance but might not be meant that way ("Great, I guess we'll be colleagues next fall then"). Of course I'd strongly recommend avoiding anything that might be ambiguous or confusing, just in case, but in practice I've never seen this actually cause a serious problem. Any sensible department will follow up to get an unambiguous answer in writing, so if the situation remains ambiguous it's because both sides screwed up.
The real question is how binding an acceptance is, assuming both sides agree the offer was accepted. In the communities I'm familiar with, you cannot unilaterally change your decision once you have accepted. You could presumably get away with it, since the department isn't going to sue you if you don't show up, but that would be very bad for your reputation. Instead, the standard approach is to explain how things have changed and ask the department for permission to withdraw your acceptance.
In certain cases, this is perfectly straightforward. Suppose an unexpected problem has arisen in your life: for example, one of your parents was just diagnosed with cancer and you want to live close to them for the next year or two. Surely any reasonable department would understand and approve.
Of course, most cases are less clear cut, and amount to personal preference. This is more likely to arise after a deferral, where you accepted a job but then went on leave for a year first, since the extra time allows for more things to change. In general, departments will be pretty unhappy if you defer and then change your mind. It's important to ask to be released from your obligation rather than simply announcing you won't come; the department will often agree, since they understand you would likely leave after a year anyway. It's not good and you should try hard to avoid this situation, but occasionally it happens. If it does, you should feel a little guilty for making it harder for other candidates to get deferrals, by contributing to the impression that people with deferrals might change their minds in the meantime.
At the other extreme, you might simply change your mind within a single yearly job market cycle and decide you prefer another offer you already had at the time of your decision. This is probably not even worth asking about: when you accept an offer, it is understood to be a final decision, and you can't just re-evaluate your options. You should officially decline all your other offers when you accept an offer; if you aren't ready to do that, then you aren't ready to accept a job yet.
Of course, the trickiest case is when you get an offer with an early deadline and have to make a decision before other universities you might prefer can make an offer. Most departments don't want to pressure people into making this kind of decision, and it's always worth asking for an extension of the deadline. Many departments will agree, but a few will not (I know of one department that strategizes about how to put time pressure on people).
If you are caught negotiating with a department that is trying to pressure you in this way, then you should be as tough as they are. On the other hand, their behavior does not mean your acceptance becomes non-binding, and unilaterally changing your mind will still look bad throughout the community. If the department refuses to grant an extension or show any other flexibility, then they are clearly indicating they want a definitive answer now, and you'll have to give them one. It's worth considering whether you even want to work for a department that would treat you that way.
As soon as you have accepted an offer, you should withdraw all your other job applications. Partly this is so they don't have to waste time evaluating a candidate who is no longer available, and partly it is because if you don't withdraw them, then it looks like you are still hoping for a better offer. That is what will really offend people, because it will look like you tricked the department whose offer you accepted by giving them what was understood to be a final decision while still staying on the market to see what other offers you could get.