Here’s my odd but working solution!
It might not be the prettiest, but it gets the job done. Sometimes, functionality comes first! 

-module(day_4).
-export([task_1/0, task_2/0]).
task_1() ->
File = "input",
{ok, RawData} = file:read_file(File),
Raw = binary:split(RawData, <<"\n">>, [global, trim]),
horizontal_sum(Raw, 0) + vertical_sum(Raw, 0) + diagonal_sum_top(Raw, 0) + diagonal_sum_bottom(Raw, 0).
horizontal_sum([], Sum) ->
Sum;
horizontal_sum([H | T], Sum) ->
Left = horizontal_xmas(H, 0),
Right = horizontal_xmas(bin_revert(H, <<>>), 0),
horizontal_sum(T, Sum + Left + Right).
bin_revert(<<>>, Acc) ->
Acc;
bin_revert(<<Char:1/binary, Rest/binary>>, Acc) ->
bin_revert(Rest, <<Char/binary, Acc/binary>>).
horizontal_xmas(<<>>, Sum) ->
Sum;
horizontal_xmas(<<"XMAS", Rest/binary>>, Sum) ->
horizontal_xmas(Rest, Sum + 1);
horizontal_xmas(<<_, Rest/binary>>, Sum) ->
horizontal_xmas(Rest, Sum).
vertical_sum([], Sum) ->
Sum;
vertical_sum([H1, H2, H3, H4 | T], Sum) ->
vertical_sum([H2, H3, H4 | T], vertical_sum(H1, H2, H3, H4, Sum));
vertical_sum([_ | T], Sum) ->
vertical_sum(T, Sum).
vertical_sum(<<>>, <<>>, <<>>, <<>>, Sum) ->
Sum;
vertical_sum(<<"X", R1/binary>>, <<"M", R2/binary>>, <<"A", R3/binary>>, <<"S", R4/binary>>, Sum) ->
vertical_sum(R1, R2, R3, R4, Sum + 1);
vertical_sum(<<"S", R1/binary>>, <<"A", R2/binary>>, <<"M", R3/binary>>, <<"X", R4/binary>>, Sum) ->
vertical_sum(R1, R2, R3, R4, Sum + 1);
vertical_sum(<<_, R1/binary>>, <<_, R2/binary>>, <<_, R3/binary>>, <<_, R4/binary>>, Sum) ->
vertical_sum(R1, R2, R3, R4, Sum).
diagonal_sum_top([], Sum) ->
Sum;
diagonal_sum_top([H1, H2, H3, H4 | T], Sum) ->
NewSum = process_columns(H1, H2, H3, H4, 0, byte_size(H1), 0),
diagonal_sum_top([H2, H3, H4 | T], Sum + NewSum);
diagonal_sum_top([_ | T], Sum) ->
diagonal_sum_top(T, Sum).
process_columns(_, _, _, _, Col, MaxCol, Sum) when Col > MaxCol - 4 ->
Sum;
process_columns(Row1, Row2, Row3, Row4, Col, MaxCol, Sum) ->
Char1 = binary:part(Row1, Col, 1),
Char2 = binary:part(Row2, Col + 1, 1),
Char3 = binary:part(Row3, Col + 2, 1),
Char4 = binary:part(Row4, Col + 3, 1),
case {Char1, Char2, Char3, Char4} of
{<<"X">>, <<"M">>, <<"A">>, <<"S">>} ->
process_columns(Row1, Row2, Row3, Row4, Col + 1, MaxCol, Sum + 1);
{<<"S">>, <<"A">>, <<"M">>, <<"X">>} ->
process_columns(Row1, Row2, Row3, Row4, Col + 1, MaxCol, Sum + 1);
_ ->
process_columns(Row1, Row2, Row3, Row4, Col + 1, MaxCol, Sum)
end.
diagonal_sum_bottom([], Sum) ->
Sum;
diagonal_sum_bottom([H1, H2, H3, H4 | T], Sum) ->
NewSum = process_columns_bottom(H1, H2, H3, H4, 0, byte_size(H1), 0),
diagonal_sum_bottom([H2, H3, H4 | T], Sum + NewSum);
diagonal_sum_bottom([_ | T], Sum) ->
diagonal_sum_bottom(T, Sum).
process_columns_bottom(_, _, _, _, Col, MaxCol, Sum) when Col > MaxCol - 4 ->
Sum;
process_columns_bottom(Row1, Row2, Row3, Row4, Col, MaxCol, Sum) ->
Char1 = binary:part(Row4, Col, 1),
Char2 = binary:part(Row3, Col + 1, 1),
Char3 = binary:part(Row2, Col + 2, 1),
Char4 = binary:part(Row1, Col + 3, 1),
case {Char1, Char2, Char3, Char4} of
{<<"X">>, <<"M">>, <<"A">>, <<"S">>} ->
process_columns_bottom(Row1, Row2, Row3, Row4, Col + 1, MaxCol, Sum + 1);
{<<"S">>, <<"A">>, <<"M">>, <<"X">>} ->
process_columns_bottom(Row1, Row2, Row3, Row4, Col + 1, MaxCol, Sum + 1);
_ ->
process_columns_bottom(Row1, Row2, Row3, Row4, Col + 1, MaxCol, Sum)
end.
task_2() ->
File = "input2",
{ok, RawData} = file:read_file(File),
Raw = binary:split(RawData, <<"\n">>, [global, trim]),
x_mas_sum(Raw, 0).
x_mas_sum([], Sum) ->
Sum;
x_mas_sum([H1, H2, H3 | T], Sum) ->
NewSum = x_mas_check(H1, H2, H3, 0, byte_size(H1)),
x_mas_sum([H2, H3 | T], Sum + NewSum);
x_mas_sum([_ | T], Sum) ->
x_mas_sum(T, Sum).
x_mas_check(_, _, _, Col, MaxCol) when Col > MaxCol - 3 ->
0;
x_mas_check(Row1, Row2, Row3, Col, MaxCol) ->
TopLeft = binary:part(Row1, Col, 1),
Center = binary:part(Row2, Col + 1, 1),
BottomLeft = binary:part(Row3, Col, 1),
BottomRight = binary:part(Row3, Col + 2, 1),
TopRight = binary:part(Row1, Col + 2, 1),
Match = case {TopLeft, Center, BottomLeft, BottomRight, TopRight} of
{<<"M">>, <<"A">>, <<"M">>, <<"S">>, <<"S">>} -> 1;
{<<"S">>, <<"A">>, <<"S">>, <<"M">>, <<"M">>} -> 1;
{<<"S">>, <<"A">>, <<"M">>, <<"M">>, <<"S">>} -> 1;
{<<"M">>, <<"A">>, <<"S">>, <<"S">>, <<"M">>} -> 1;
_ ->
0
end,
Match + x_mas_check(Row1, Row2, Row3, Col + 1, MaxCol).