How do I add taxonomy to my custom entity?
As Clive said, you use an entity reference field for that, just like articles have a tags reference field to terms.

If you want to define it in code, it's really the same as the node.uid field, which is an entity reference to a user. Or the user.roles field, which is a multivalue reference to user roles. Entities reference others using an entity reference field, it's always the same pattern.