First of all, let me say that if this is your largest problem with your grandson at the age of 2 you are probably doing a decent job of raising him.
It is "normal," or at least "traditional," that some boys feel this way.
From my limited perspective of raising a son and having been raised as a son, the preconceived notions and biases of a child seem to me to vary between 1) random and bewildering and 2) "traditional" and either frustrating or humorous.
I would describe this as a "traditional" bias in western culture (going off of the name Diana I assume that this is your culture), and it is obviously frustrating for you or you wouldn't be posting here. Some people, viewing this from the outside, would find it childishly humorous:
It is normal that you feel the way you do.
If I were you, as a female grandmother who does 50% of the work of raising him, it might annoy or alarm me that he is treating "female" objects as inferior. It might be also be somewhat alarming to hear this coming from a toddler at 2 years old. 5 years old? Sure. 2 years old? These biases come from every direction, some might even say some biases are ingrained (not a popular line of thought these days), but it is possible that his dad is influencing him in this if he's reacting like this at age 2. Possible, but make no assumptions.
The Dad.
You might have an interesting conversation with his father about this. If you feel comfortable with talking to the dad about it, simply ask him if he's seen this behavior while he is watching the child. Maybe keep a neutral face and don't appear to be overly worried. You can probably figure out how the dad feels about this issue by his reaction to the topic.
If you do not want to approach the dad about the issue, or if you do and he's somewhat hostile about the subject matter, you can tackle this from your angle of doing half of the child-rearing and let the child find his own path between the two of you.
Color and Insecurity.
First of all, were the pajamas pink? Were they "girly" colored? I still won't wear pink even though many Catholics from a century ago were dressing boys in pink and girls in blue (the color of Mary). Some guys I know will wear pink, and they look good and they're hetero and "manly", and they're secure in their own skin and nobody thinks anything about it.
I not only don't like the color but I won't wear it because of ingrained insecurity. I remember seeing a picture of myself as a boy with a pink tank-top and being embarrassed ever since - what was I thinking?! - even though it's only a color. Getting your grandson to overcome color bias might be a long haul, and he can turn in to a fine young man who treats women equally and with respect who doesn't like to wear pink, and that's ok. But I think you're looking to get him beyond this so that 30 years from now he's not a grown man admitting to the Internet that he's scared of wearing pink shirts. Good for you.
NO GIRLS ALLOWED!
Let's say it wasn't pink, but an overreaction to the fact that it was just random build-a-bear pajamas and he seems to be completely hostile to the notion that it may be "girly." Let's say this hostility runs over into an objection to girls in general (based in insecurity or ingrained bias or for whatever reason). Then you have a more interesting problem on your hands.
Growing up in the 80's and 90's, most male child friends I had had a bias like this, and if my memory serves me correctly I did not because I was perfect I did too. This generally lasts (for heterosexual boys, who may be more likely to have these biases) until an interest in girls forms... or forever, depending.
Luckily, in Western culture this subject matter of gender bias has been handled in numerous ways for some decades, often at the level of a toddler's understanding.
Got any old Berenstain Bears books lying around? Like, say, this one:
Maybe he's not big into books right now:
Berenstain Bears on Youtube
(Note that this addresses bias toward actual girls more than girly items.)
Maybe he's too young and won't get it, or maybe this won't have any effect at all on him. Books and TV shows can help spread horizons, but they aren't a substitute for parenting.
Even if this doesn't address your concerns, the storyline of the show itself gives a sortof classic child-rearing road map to doing so: reverse psychology.
Coming to an Understanding
(Before going into this, I should note that "reverse psychology" schemes have a funny way of backfiring; I'm more suggesting that you employ your relationship with your grandson to explore this type of bias from an angle and get him to come to an understanding on his own rather than trying to confront him about it.)
An example of what you might do:
Find an object that he desires. Maybe a new one, maybe an old favorite. Let him approach it and start to take it. Then remove it from his royal presence as if it would offend him and declare "this is too girly for you!"
Or:
Make some cookies. A small batch. Pink icing, or whatever. Oops! Too girly. You'll have to eat them all, since you're a girl and he's not. He can't have girly things in his presence.
Etc.
(He's a toddler, 2 years old, so my advice here could lead to a meltdown or resistance or "You're right, everything is too girly, I will wear red and black forever!" I don't know him, you do, so maybe think of something that is ritual/routine and that might not set him off but might get him to understand and learn from this situation.)
Don't torture him, just employ your relationship and your ownership of the things around him to get him to understand that objects have qualities beyond their color or his perception of their femininity. And slowly over time, using similar methods, you can get him to understand that people have qualities beyond their color or his perception of their femininity.
Good luck. He's a toddler, you're gonna need it.