The grandma taking the last ones when she knows your DD loves them and when she presented them to your DD as HER present is just....wrong.
I agree with the pp who sort of said that this is a matter of perception. MIL thinks of them more as a hostess gift for your family, but like people do with a lot of little kids, they make things more 'personal' for the child. So she said they were for your DD when she doesn't really intend that at all.
I don't think it should be hidden from your MIL what happened when she ate the last couple of pieces and left none of your DD's supposed present for her. Let her know about how upset your DD was and how SHE is perceiving it. I've had to do this with people (even my DH); "Look, she's a little kid. She believes you when you say X. She doesn't understand that you're joking/she doesn't understand the nuances of a household gift."
So before the next visit, I might call MIL on the phone when plans are being made and say something like: "Hey, MIL? I was just wondering....are you planning on bringing shortbread again like you often do? Oh, good, that would be wonderful. Yours always turns out better than mine; you have that touch! But hey, can I ask a favor? Usually when you come, you give it to DD and say you made it for her. When she hears that, she thinks the whole batch is exclusively for her, not that you just happened to make THAT particular thing because she likes it. She's THREE, and she takes those types of statements very literally and expects that it will all be hers; that it won't be shared among everyone. Last time, right after you left, she opened the tin to find it all gone, and she was SO disappointed. She started crying and I just couldn't console her because she wanted HER treat and she didn't understand why it was all gone, already. Yeah, she REALLY likes your shortbread. So for the favor .... when you bring it, please don't say it's all for her unless that's really true. I just don't want her to be disappointed again if she sees everyone eating what she thinks is just HER present. Or if you want to portion some out just for her, and some for the rest of us to share, that would be fine too. But she needs to know that if someone gives HER something and specifically tells her that, that the thing really is for just HER and other people won't take it."
Sometimes people just need a reminder of the three-year-old mindset, and how they are coming across.