Oh boy. Sorry, there isn't going to be one magic answer to this. I can tell you what we did with my in-laws, though.
First, we acknowledged that my MIL shows love by giving gifts. She looked at me and said, "You know, you're right. My mom would give or send me little things and I always knew that she was thinking about me, and she cared." So of course that's something she wants to give her granddaughter! And she should be able to. Acknowledging that this came from a place of love was probably the thing we did the most right, because following conversations have been much easier since we all know where we stand.
When the in-laws visit I have a list of needs that we suggest, only IF they feel like buying something. That way they know we could buy the needs if necessary, but it gives my MIL a starting point. We're not going to stop her from buying stuff, but if she knows what our daughter actually needs (clothes, shoes, even underwear and socks) then she's far more likely to check those boxes first.
They know we like books of all kinds and encourage lots of reading. One of this year's Christmas presents was a book of the month deal where the grandparents pick out a book (sometimes a specific one at our suggestion) and that way they get to send something each month that is used and enjoyed. I think, since they live in a different state, they're most worried that she'll forget about them between visits. This way they know we're talking about them a lot. (Which we would do anyway, and our girl clearly hasn't forgotten them, but whatever. I won't judge that fear since, again, it comes from a place of love.)
We spoke to them before she was born about the college account, how having money set aside helped both me and my husband. So instead of sending cheap junk for Valentine's Day or whatever, they send a card and a receipt that $25 was deposited into her college fund.
We've also emphasized experience, and pointed out that our living space is quite small. We've also mentioned which toys she plays with the most. Those tend to be the most imaginative ones, like Legos and blocks. Grandma made a "buys book" one Christmas and that's been an amazing one. It's mostly self-contained so we can take it along to, say, the doctor's office or anywhere else where we'd need to wait. It also teaches skills, like zipping and buttoning and tying shoes. So great. We've let our appreciation be known (especially since Grandma spent months sewing it).
The hardest conversation we had, however, was with the endless parade of Frozen items. They found out she likes Frozen (although, not more than any other movie she's seen) and they ran with it. She got: four dresses, shoes, a Halloween costume, a swimsuit, and two bags. We asked to please stop with the Frozen-themed stuff and Grandma got pretty upset. I think she thought we were trying to put a moratorium on all gift-giving when what we wanted was a bit more variety. Some themed character stuff is totally fine. Getting everything themed? Please no. So that was a rough conversation that ended with some hurt feelings, unfortunately. We've learned, and we'll do better the next time we (inevitably) have to bring this up again for something else.
As others have said, it's not the end of the world if she gets outside influences about Pink! and princesses and whatnot. We had friends visit over the weekend and since they left my girl keeps talking about things being pink. I'm sure this is because of the (slightly older) daughter of our friends, as my girl has been saying for months that her favorite color is blue. So we talked about favorite colors, what are mine and daddy's and the grandparents' favorite colors. I asked what hers were and she said blue and red. I think that's the best way to fight back against the idea that girls must love pink, to remind her that everyone gets to choose their favorite colors.