I'm recently watching "How I Met Your Mother" again, and I'm noticing some weirdness. In early seasons, the word "bitch" was used a couple of times, i.e. Season 2 Episode 4 Ted Mosby: Architect Robin says "I love being the person you bitch to". Yet in another episode much later, they censor it, i.e. Season 2 Episode 11 How Lily Stole Christmas Ted tells Lily "You were kind of a grinch", but the narration hints that he meant 'bitch'. Was it censored due to the context?
Your question is a little problematic (in a good way, though), because it's actually based on a false premise/example and makes much more sense as a How I Met Your Mother question than as a general TV question.
I can't really say much about the general question if TV channels censor content based on dialogue context, however, I'd doubt that, since that would involve far too much work. While TV channels are known to sometimes even redub scenes of movies with a higher rating with different words for making them "appropriate" (e.g. Sam Jackson's famous line from Snakes on a Plane about "monkey-fightin'" snakes on a "monday-to-friday" plane), they would rather have a blacklist of "bad" words you can say than assess each and every scene on its own, let alone take care of fitting any possible replacement words to an overall christmas theme. But so much to my general and rather unbacked statements.
But the much more interesting question here is specifically about How I Met You Mother and its ways of storytelling, since you actually picked a very interesting example. In this specific episode this is all entirely the show doing the "censorship" and that on purpose. You have to keep in mind that this is all still Ted Mosby telling a story to his kids and the show is famous for occasionally playing with this concept of an unreliable narrator. Other examples for this would be:
- Ted revealing at some point that in all the previous episodes all the characters were actually heavy smokers and smoked all the time.
- The whole physical and narrative replacement of joints with sandwiches.
Of course it's not always entirely consistent, as you pointed out yourself. Sometimes he censors stuff as innocuous as "shit" and other times he freely talks about Barney's kinky adventures with his "dates". But they don't use it for censorship at all, since those are all concepts you could talk about freely in a TV-show. They use it entirely as a story-telling technique for humourous effect, illustrating the actual frame-narrative structure of the show.
So Ted calling Lily a grinch instead of a bitch in this episode does not only cater into this common motif but also adds to the christmas theme of the episode. So yes, it was censored due to the context, but no it wasn't done by the TV channel nor for the sole purpose of censorship.