Unfortunately, there is no such possibility using Business Unit membership rules directly. As a solution, you can use a Scheduled Task and two PowerShell scripts. The scripts will add/remove a membership rule specifically for each user based on the custom attribute value. The task will look like the following:
Additionally, to make sure that after updating the custom attribute users are directly added/removed from the Business Unit, a Business Rule triggering After updating a user will be used:
If this approach meets your needs, we will provide you with the scripts.