the list of tags is stored in `tags-table-list`, when you load a file, you know the full path of that file (`C-h v buffer-file-name`), so you can tweak `tags-table-list` by `buffer-file-name` and make it `buffer local`. BTW, you need create individual TAGS for each languages. For example, one TAGS for javascript, another TAGS for PHP. That's actually pretty easy if you follow the suggestion from Emacs manual by using GNU Find AND Ctags together (https://www.gnu.org/software/emacs/manual/html_node/emacs/Create-Tags-Table.html) since you can specify the file extension when scanning files. You still need write a little bit Emacs Lisp code but https://github.com/redguardtoo/find-and-ctags help you write less code.