Text this: Physics and applications of terahertz metagratings