Unfortunately you can only use one domain at time. Even if you add the root DC of the forest in the Connection URL you can only specify one domain in either the User base or Group base. This mean either AAA.com or BBB.com. I don’t know if you can use the root domain in the user or group base. If AAA and BBB are in the same forest they probably share the same base domain (something like mydomain.com) and they are specified like AAA.mydomain.com and BBB.mydomain.com.
You can try to add the root domain in the Connection URL and put DC=mydomain,DC=com and see if the sub domain are automatically queried. However I believe that the root DC mydomain.com must be a Global Catalog. Take a look at this post. So it seems like the port used in the Connection URL also matters.
Let us know if you can get it working.