To "bite the bullet" means to accept that something unpleasant or difficult is sure to happen. It is often used when someone has tried easier or simpler alternatives for a task, but those methods have not been successful; however, trying other alternatives before going to the harder way is not required.
An easy way to remember this definition is to imagine a soldier biting a bullet while having emergency surgery on the battlefield with no medicine for pain. (This is often considered the origin of the phrase, but there is little evidence to support that claim.)
On the other hand, to "grit one's teeth" means to prepare for a challenge or strengthen one's will. This is a more general term, which can be used for a person dealing with any challenge, not necessarily an unavoidable one.
Anyone who is "biting the bullet" will probably "grit their teeth," but just because someone is "gritting their teeth" it doesn't necessarily mean they've "bitten a bullet."
EDIT to add requested examples:
Bob's car broke down on a highway in the middle of the desert. He tried to fix it himself but didn't know how. He tried flagging down someone passing by for a ride or to borrow a phone but nobody stopped. After a couple hours, Bob decided to bite the bullet and walk the 25 miles back to the last service station he passed.
Alice really wanted to make her school's football team. She was already tired from a day at the gym but she gritted her teeth and told herself to do one more set of push-ups so she could beat the competition.