If you want blocks to be shown only on pages with specific tags, this is an example implementation.
This will insert beans with the tag-field enabled into a page with similar tags.
It is assumed that both bean type and node type has field_tags.
The bean type is called tag_sensitive_block, and the code simply calls for all beans of this type and collects those that share a tag with the current node. Then it inserts $max_beans beans into the first and second sidebar, switching between them after each insert.