How do I modify the contents of {{var alertGrid | raw}} in the template?

How do I modify the contents of {{var alertGrid | raw}} in the template?

The full content of the mentioned variable is located in the following file:

/vendor/magento/module-product-alert/view/frontend/templates/email/stock.phtml
     
It is better to edit the mentioned file via the theme folder. For that, the file should be created in this path:

app/design/frontend/<VendorName>/<ThemeName>/Magento_ProductAlert/templates/email/stock.phtml
      
The created file can be used for editing the {{var alertGrid | raw}} variable. 

If your theme is installed in the vendor folder, it won't be possible to redefine files via the app/design folder.