Groups work like a tagging system. I typically use them as a way to check how nodes should interact with each other.
Let's say you want to check if the object your player is colliding into is part of the environment or an enemy. We create various scenes for enemies and environments and place each scene into their corresponding groups, either "environment" or "enemy".
Tree, Bush, and Fence scenes are put into group "environment"
Spider, Bird, and Dog scenes are put into group "enemy"
Now you go ahead and create a level in your game built with those six different nodes. You place your character into the scene and start running around colliding into things. If you want to know what you are colliding into you could do:
if colliding:
var name = object_i_collided_with.get_name()
if name == "Spider" || name == "Bird" || name == "Dog":
print("GAME OVER")
Or you could check what group the object is in:
if colliding:
if object_i_collided_with.is_in_group("enemy"):
print("GAME OVER")
if object_i_collided_with.is_in_group("environment"):
print(object_i_collided_with.get_name()) #check what player knocked into
Not sure if this is the best explanation on how to use groups, but hopefully it helps a little.