The Glass Heart was the object of central importance in the (entirely made-up) detective story Walter Bishop told young Ella Blake in the episode, Brown Betty.
The heart, which was indeed partially made of glass, was a power source of great strength, something the fictional counterpart of Peter Bishop was naturally born with; a steel door on his chest could be opened to expose the heart. When Peter Bishop learned that his mentor, tinkerer Walter Bishop (no relation), was dying, he offered Walter the glass heart, sacrificing himself so that Walter could live, as Walter was the creator of many good things in the world, including rainbows, hugs, and teddy bears.
However, after he discovered that Walter gained all his ideas by stealing them from the dreams of children and replacing them with nightmares, he took the heart back and left, leading a dying Walter to hire Detective Olivia Dunham to find him.
In Walter's original ending for the story, although the sickly Walter Bishop begged Peter for another chance to undo the harm he'd done in the past and create good things again, Peter turned him down and left with his new love, Detective Dunham, taking the heart with him.
In the happy ending made up by Ella, Peter decided that the old man still had some good left in him, and broke the heart in half. It continued to function perfectly, and each Bishop took a half of it to keep themselves alive. Afterwards, Walter, Peter, and Olivia worked together to make the world a happier place.
Walter and Ella both agreed that her ending was better.