How can I set up a "many to many" relation with an entity
You can set unlimit cardinality, some like this:

-&gt;setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)

This create a intermediate table to reference two entities.

Check api documentation: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Field%21BaseFieldDefinition.php/function/BaseFieldDefinition%3A%3AsetCardinality/8.6.x