When you pour boiling water into a glass, the inside of the glass becomes much hotter than the outside of the glass.
As heat makes glass expand, the inside of the class becomes a different size to the outside of the glass, causing tension which can make the glass crack.
If you put a spoon in the glass it will absorb some of the heat, reducing the possibility of cracking the glass.