The .CGI file format (Common gateway interface script) is an executable script that is often written in either the Perl or C languages.
These scripts are most commonly found on web-servers, within a special folder named 'cgi-bin'.
When these scripts are called, they are executed on the web server and they process whatever task they've been set to do, before returning the result.
CGI scripts can be compiled so that they run more efficiently. If this is the case, you'll not be able to edit the cgi file.