If a page uses a custom script it has to tell the AMP system that it will eventually have a custom tag, AMP then creates the required tag so the page doesn't slow down.