Generally stands for "Giggles to Self". Can be used in place of "LOL" since most people are actually giggling quietly or in their head instead of laughing out loud.
Capitalization doesn't really matter.
Depending on the conversation, its definition and use may vary as seen below:
1. You have amused me but I'm not in a place where laughing out loud is appropriate.
2. I needed something to reply and I am smiling so here ya go.
3. I am amused but not to the point or roaring guffaws.
Example use in a text message:
Person 1: Hey did you see that dude behind you?
Person 2: Yup couldn't miss him.
Person 1: You think those glasses are thick enough?
Person 2: If he looked at a map he could see people waving.
Person 1: *gts*