Heat a comal over medium heat and place the tomatoes, quarter onion and whole habanero (if using) on it, and toast for 10 to 12 minutes, flipping once in between, until completely charred. Alternatively, place on a baking sheet under the broiler, and broil for 10 to 12 minutes, flipping once, until completely roasted. Remove from the heat and let cool.
Chop the charred onion, as well as the habanero, removing its seeds.
Completely mash the tomatoes in a molcajete, and incorporate the onion, cilantro, and salt.
First, add half of the habanero and mash until well mixed. Taste for heat and add more habanero if desired.
Alternatively, put the ingredients in a blender or food processor and process until fully combined but still chunky.