FileRef has attributes that are available during page templating and rendering (in page context). This operation collects attributes from various locations.
Same files but in any upper folders. This way we can define some attributes for all subfolders or all subpages of the site.
__.js in the same folder where file is. Difference from single-underscored attribute files (explained above) is that they are only applied to the same folder, and not child folders. They are shared only by files in the same folder.
<filename>_.json the same as for double-underscored attributes; but they are not shared.
Using various attribute files you can set some attributes on 1) large collection of files and subfolders, 2) only files in the same folder and 3) only specific file.