Diesel-fueled generators are widely used for power generation in remote and/or off-grid communities. In such communities, local organic waste streams can be used to generate biogas, which can be used to replace diesel used by diesel generators to lower fuel cost and reduce greenhouse gas (GHG) emissions. Diesel-powered generators can be easily retrofitted with a biogas dosing line in the engine intake to introduce biogas, but appropriate optimization would be of great help to further improve generator performance and reduce GHG emissions. The objective of this research is to demonstrate simplified optimization methods that can reduce GHG emissions (carbon dioxide and methane) from such retrofitted dual-fuel engines under various biogas compositions. The study was conducted on a modern 30 kilowatt (kW) generator using an electronically controlled, four-stroke, four-cylinder, direct injection, turbo-charged diesel engine. The engine was operated with the factory electronic control unit (ECU) and a programmable ECU which allowed for control of the fuel injections and exhaust gas recirculation valve. Biogas was simulated by using natural gas (with more than 95% methane by volume) which was diluted with either carbon dioxide or nitrogen. This study consisted of two areas. The first one was the comparison of the engine performance when operating with biogas using the factory ECU and the programmable ECU with user-optimized fuel injection. The second one was the influence of volume fraction of carbon dioxide or nitrogen in the biogas. Test results reinforced the importance of optimizing the diesel injections when the engine was operated in the biogas-diesel dual-fuel mode to ensure complete combustion and achieve a reduction in GHG emissions. Increasing nitrogen fraction had a minimal effect on the emissions but increasing carbon dioxide fraction caused the NOx and methane emissions to decrease, and the indicated thermal efficiency to increase.