Create a button in a ribbon and pass the following parameters: SelectedControl, SelectedControlItemIds, SelectedEntityTypeName
Beware that this is totally unsupported way of doing a this.
function openReport(gridControl, recordIds, selectedEntityType)
{
var reportId = "{reportGuid}";
var filterTable = true;
var reportType = 1;
var fileName = "REPORT NAME
Mscrm.RunReportFromGrid.$j(gridControl, recordIds, filterTable, reportId, reportType, fileName);
}