Differences between .out and .sql in pg_dump PostgreSQL
Actually in these examples the used extensions don't really matter: both exports are plain text (i.e SQL) scripts. You decide which extension to use: if you export in plain SQL it's better to use .sql extension but you can choose another one.

In general you decide which extension you use. Neither psql nor pg_restore have a mandatory extension for the export file. If you use another output file format (-Fc or -Ft) for pg_dump it's better to use another extension than .sql to remember which export format has been used.