Teratoma

This is the location of the final battle with The Maw.

First Ending
Kill The Maw without gathering an energy fragment or start the encounter before gathering all the Henge Fragments and learning how to kill the Maw from the Elders in Gogombob City.

Second Ending
First you must gather all of the Henge Fragments and complete the encounter in Lodestarhenge. Afterwards, visit Gogombob City and watch the cutscene.

During the fight you must gather an energy fragment; before completing the encounter. This can be done in several ways:
 * Using the Scoundrel ability Steal Component or the Vampire/Bounty Hunter ability Shakedown on a Viscerawyrm
 * Killing a Viscerawyrm with the Ranger ability Collect Pelt or the Bounty Hunter ability Collect Trophy
 * There is a small chance one will drop when a Viscerawyrm is killed normally

You will then automatically travel to Lodestarhenge for a second encounter. Kill The Maw there.

These two missions are fought consecutively. Between fights you cannot do anything that would require you to go to a new map location: clear injuries, buy gear, recruit characters, etc. Between fights you may do anything you can do before a normal encounter: assign AP, set abilities, change classes, change equipment, etc.

Post-game
After getting either ending, you will be prompted to save your game with the Cleared flag (a Star next to it in the save game list). You keep all exp and AP earned in the final story encounter, but may choose to do the story mission in Teratoma again. This allows you to get both endings on the same save file.

If you haven't completed the Ancient Path yet, this is a great opportunity to do so.